﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Libs.Content;

public partial class Pages_Product : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack) return;

        NewsWeb _NewsWeb = new NewsWeb();
        List<NewsWeb> list;
        List<NewsWeb> list4 = new List<NewsWeb>(4);

        list = _NewsWeb.GetList(2, 0, 16);

        //for (int i = 0; i < list.Count; i++)
        //{
        //    _NewsWeb = list[i];
        //    if (_NewsWeb.SubLead.Length > 180) _NewsWeb.SubLead = _NewsWeb.SubLead.Substring(0, 180) + "...";
        //    _NewsWeb.ImageUrl = AppUtils.ImageUrl(_NewsWeb.ImageUrl, "290", "180");
        //    list[i] = _NewsWeb;
        //    list4.Insert(i, _NewsWeb);
        //}

        //if (list.Count > 4)
        //{
        //    list4.RemoveRange(4, list4.Count - 4);
        //    list.RemoveRange(0, 4);
        //}
        //else
        //{
        //    list.Clear();
        //}
        if (list.Count > 2)
        {
            rptList.DataSource = list.Take(2);
            rptList.DataBind();

            list.RemoveRange(0, 2);

            rptNewList.DataSource = list;
            rptNewList.DataBind();
        }
        else
        {
            rptList.DataSource = list;
            rptList.DataBind();
        }
        

    }
}